import request from '@/config/axios'

export interface TransferItemManagementVO {
  id: number
  transferItemNo: string
  transferItemProductNumber: string
  transferItemProductName: string
  status: string
  transferItemManager: string
  transferItemTime: Date
  taskTransferItemNumber: number
  taskTransferItemCost: number
  abnormalTransferItemNumber: number
  abnormalTransferItemCost: number
  abnormalId: number
  taskId: number
  creatorName: string
  updaterName: string
}

// 查询转项管理列表
export const getTransferItemManagementPage = async (params) => {
  return await request.get({ url: `/order/transfer-item-management/page`, params })
}

// 查询转项管理详情
export const getTransferItemManagement = async (id: number) => {
  return await request.get({ url: `/order/transfer-item-management/get?id=` + id })
}

// 新增转项管理
export const createTransferItemManagement = async (data: TransferItemManagementVO) => {
  return await request.post({ url: `/order/transfer-item-management/create`, data })
}

// 修改转项管理
export const updateTransferItemManagement = async (data: TransferItemManagementVO) => {
  return await request.put({ url: `/order/transfer-item-management/update`, data })
}

// 删除转项管理
export const deleteTransferItemManagement = async (id: number) => {
  return await request.delete({ url: `/order/transfer-item-management/delete?id=` + id })
}

// 导出转项管理 Excel
export const exportTransferItemManagement = async (params) => {
  return await request.download({ url: `/order/transfer-item-management/export-excel`, params })
}

// 选择异常物料
export const getAbnormalMaterial = async (params) =>{
  return await request.get({ url: `/order/transfer-item-management/abnormal/page`, params })
}

// 获取生产任务
export const getTaskPage= async (params) =>{
  return await request.get({ url: `/order/transfer-item-management/task/page`, params })
}

// // 获取单个异常物料
export const getAbnormal= async (id) =>{
  return await request.get({ url: `/order/transfer-item-management/abnormal?id=` + id })
}

// 通过产品编号获取生产任务单数据
export const getTaskByProductNumber= async (transferltemNo) =>{
  return await request.get({ url: `/order/transfer-item-management/getTaskByProductNumber?transferItemNo=${transferltemNo}`})
}

// 提交
export const submitTransferItemManagement= async (data) =>{
  return await request.post({ url: `/order/transfer-item-management/Submit`, data })
}

// 保存
export const saveTransferItemManagement= async (data) =>{
  return await request.post({ url: `/order/transfer-item-management/save`, data })
}